/*
 * Copyright (c) 2025 [ByteDance Ltd. and/or its affiliates.] and/or its affiliates
 * SPDX-License-Identifier: LGPL v2.1+
*/
#ifndef ANDROID_FFmpegXORIODecryptor_H
#define ANDROID_FFmpegXORIODecryptor_H

#include "FFmpegBaseXORIOCryptor.h"

class FFmpegXORIODecryptor : public FFmpegBaseXORIOCryptor {
public:
    bool isEncryptor() const override { return false; }

    virtual int prepare(const char *url, AVFormatContext *formatContext, const AVDictionary *options, const std::map<std::string, FFAny> *params) override;

protected:
    int readPacket(uint8_t *buf, int bufSize) override;
    int64_t seek(int64_t offset, int whence) override;

private:
    int findBdveTag(uint32_t *tagSize);
    int parseBdveTag(const uint32_t tagSize);
};

#endif   // ANDROID_FFmpegXORIODecryptor_H
